Skip to content

feat(proc): killGroup, the group kill run uses, for a signal handler - #20

Merged
HaoZeke merged 1 commit into
mainfrom
feat/kill-group
Nov 16, 2026
Merged

HaoZeke merged 1 commit into
mainfrom
feat/kill-group

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

proc.killGroup(pgid, sig) makes public the group kill that run uses, for signal handlers. It signals the process group that Options.pgid_out published. While the child has not made that group yet, it signals the child itself and then the group again. A pgid of 0 or less does nothing, so a handler cannot signal its own process group by accident.

It makes only kill system calls and does not wait, so it is safe in a signal handler. run, stopGroup and waitGroupGone now use it, with no change in behaviour. The new test calls it on a child before and after the child has made its group, and fails without either the fallback or the guard.

This would ship in v0.9.0.

A handler that kills the child run is waiting on, by the pgid that
Options.pgid_out published, had kill(-pgid), which misses a child that
has not made its group yet, or stopGroup, which also waits for the
group to go. killGroup is the kill run itself uses: the group, or while
there is no such group the child itself and then the group again. It
makes only kill system calls, so a handler may call it, and ignores a
pgid of 0 or less, which kill would take for the caller's own group.
The test calls it from a handler, on a child that has not made its
group and on one that has, and fails without the fallback or the guard.
@HaoZeke
HaoZeke merged commit 07e2598 into main Nov 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant